home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / graphic / pvquan16.zip / QUANT / QUANT.H < prev    next >
C/C++ Source or Header  |  1992-11-30  |  3KB  |  92 lines

  1. /************************************************************************
  2.  *                                                                      *
  3.  *                  Copyright (c) 1991, Frank van der Hulst             *
  4.  *                          All Rights Reserved                         *
  5.  *                                                                      *
  6.  * Authors:                                                             *
  7.  *      FvdH - Frank van der Hulst (Wellington, NZ)                     *
  8.  *                                                                      *
  9.  * Versions:                                                            *
  10.  *    V1.1 910626 FvdH - QUANT released for DBW_RENDER                  *
  11.  *    V1.2 911021 FvdH - QUANT released for PoV Ray                     *
  12.  *    V1.5 920403 FvdH - Allow any number of files                      *
  13.  *    V1.6 921023 FvdH - Produce multi-image GIFs                       *
  14.  *                     - Port to OS/2 IBM C Set/2                       *
  15.  *                                                                      *
  16.  ************************************************************************/
  17. /* quant.h -- definitions global to quant package */
  18.  
  19. #include <stdio.h>
  20. #ifdef __TURBOC__
  21. #include <stdlib.h>
  22. #include <alloc.h>
  23. #include "..\vga\vga.h"
  24.  
  25. #define HUGE_PTR huge*
  26. #else
  27.  
  28. #define HUGE_PTR *
  29. #endif
  30.  
  31. #ifdef __GNUC__
  32. #define cdecl
  33. #endif
  34.  
  35. #define TRUE        1
  36. #define FALSE        0
  37.  
  38. /* Readability constants. */
  39. #define RED            0
  40. #define GREEN        1
  41. #define BLUE        2
  42.  
  43. /* Maximum number of colormap entries.  To make larger than 2^8, the rgbmap
  44.     type will have to be changed from unsigned chars to something larger. */
  45.  
  46. #define MAXCOLORS        256
  47.  
  48. #ifdef HECKBERT
  49. #define INPUT_BITS 5
  50. #else
  51. #define INPUT_BITS 8
  52. #endif
  53.  
  54. #ifdef __TURBOC__
  55. #define CHECK_ALLOC( ptr, type, number, msg) {\
  56.     if ((ptr = (type *) farmalloc((long)sizeof(type) * (unsigned long)(number))) == NULL) {\
  57.         printf("\nCreating %s: MALLOC - out of memory\n", msg);\
  58.         exit(1);\
  59.      } \
  60.   }
  61. #else
  62. #define CHECK_ALLOC(ptr, type, number, msg) { \
  63.     if ((ptr = (type *) malloc(sizeof(type) * number)) == NULL) { \
  64.         printf("\nCreating %s: malloc - out of memory\n, msg"); \
  65.         exit(1); \
  66.     } \
  67. }
  68. #endif
  69.  
  70. #define putw(word, file) {\
  71.     putc((word) & 0xff, file);\
  72.     putc((word) >> 8, file);\
  73.     }
  74.  
  75. typedef unsigned char UCHAR;            /* 8 bits */
  76. typedef unsigned short int UINT;    /* 16 bits */
  77. typedef unsigned long int ULONG;        /* 32 bits */
  78.  
  79. extern UCHAR palette[MAXCOLORS][3];
  80. extern char                disp_image;        /* Display image flag */
  81. extern char                input_type;        /* Input format switch */
  82.  
  83. void open_file(char *fname, int num);
  84. void err_exit(void);
  85. extern int (*get_pixel)(UCHAR *p);
  86. void write_file(int num_files, char *input_file, int Xres, int Yres,
  87.                      int colors, int output_type);
  88. void close_file(void);
  89.  
  90. int    pal_index(UCHAR *pixel);
  91.  
  92.